﻿class @CategoriesRouter extends Backbone.Router
    routes:
        "Categories/:categoryId*path": "Index"

    Index: (categoryId, path) ->
        layout = new LibraryLayoutView()
        model = new CategoriesModel()
        model.set("CategoryId", categoryId)

        column = Url.GetParameterByName("Column")
        if column.length
            model.setStaticProperty("Column", column)

        direction = Url.GetParameterByName("Direction")
        if direction.length
            model.setStaticProperty("Direction", parseInt(direction))

        viewType = Url.GetParameterByName("viewType")
        if viewType.length
            model.setStaticProperty("BookViewType", parseInt(viewType))

        view = new CategoriesView({ model: model })